package com.example.demo.service.imp;

import com.example.demo.pojo.SingleChoice;
import com.example.demo.mapper.SingleChoiceMapper;
import com.example.demo.service.SingleChoiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SingleChoiceServiceImp implements SingleChoiceService {

    @Autowired
    private SingleChoiceMapper singleChoiceMapper;

    @Override
    public List<SingleChoice> getAll() {

        return singleChoiceMapper.querySingleChoiceList();
    }

    @Override
    public SingleChoice getById(int id) {
        return singleChoiceMapper.getById(id);
    }

    @Transactional
    @Override
    public void add(SingleChoice singleChoice) {
        singleChoiceMapper.add(singleChoice);
    }

    @Transactional
    @Override
    public void delete(Integer id) {
        singleChoiceMapper.delete(id);
    }
}
